home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / Gnuplot / Source / term / fg.trm < prev    next >
Encoding:
Text File  |  1993-03-02  |  4.3 KB  |  246 lines

  1. /* GNUPLOT - fg.trm */
  2. /*
  3.  * Copyright (C) 1990, 1991, 1992
  4.  *
  5.  * Permission to use, copy, and distribute this software and its
  6.  * documentation for any purpose with or without fee is hereby granted, 
  7.  * provided that the above copyright notice appear in all copies and 
  8.  * that both that copyright notice and this permission notice appear 
  9.  * in supporting documentation.
  10.  *
  11.  * Permission to modify the software is granted, but not the right to
  12.  * distribute the modified code.  Modifications are to be distributed 
  13.  * as patches to released version.
  14.  *
  15.  * This software  is provided "as is" without express or implied warranty.
  16.  *
  17.  * This file is included by ../term.c.
  18.  *
  19.  * This terminal driver supports:
  20.  *    Under Zortech C
  21.  *      egalib, vgalib, vgamono, svga, mcga, cga, hercules, att
  22.  *
  23.  * AUTHORS
  24.  *          Gnuplot for DOS 386/flash graphics
  25.  *                  Clifton T. Liu
  26.  *
  27.  * Send your comments or suggestions to
  28.  *  info-gnuplot@dartmouth.edu.
  29.  * This is a mailing list; to join it send a note to 
  30.  *  info-gnuplot-request@dartmouth.edu.  
  31.  * Send bug reports to
  32.  *  bug-gnuplot@dartmouth.edu.
  33.  */
  34. /* The modifications to allow Gnuplot to compile with Zortech C/C++   */
  35. /* 3.1 /Flash Graphics    were made by Clifton T. Liu                   */
  36. /* (cliu@merlin.appmath.columbia.edu)         20 Feb 1993              */
  37.  
  38. #include <fg.h>
  39.  
  40. static int pattern[] = {0xffff, 0x0f0f, 0xffff, 0xaaaa, 0x3333, 0x3f3f, 0x0f0f};
  41.  
  42. static int graphics_on = FALSE;
  43. int startx, starty;
  44. /*
  45. int pc_angle;
  46. #define PC_VCHAR FNT5X9_VCHAR
  47. #define PC_HCHAR FNT5X9_HCHAR
  48. */
  49. pause()        /* press any key to continue... */
  50. {
  51.     (void) getch();
  52. }
  53.  
  54.  
  55. PC_text()
  56. {
  57.     if (graphics_on) {
  58.         graphics_on = FALSE;
  59.         pause();
  60.     }
  61.    fg_term();
  62. }
  63.  
  64. PC_reset()
  65. {
  66. }
  67.  
  68.  
  69.  
  70. /* all of the FlashGraphics C routines for the different graphics devices go here */
  71.  
  72.  
  73. #define HERC_XMAX 720
  74. #define HERC_YMAX 348
  75.  
  76. #define HERC_XLAST (HERC_XMAX - 1)
  77. #define HERC_YLAST (HERC_YMAX - 1)
  78.  
  79. #define HERC_VCHAR 10
  80. #define HERC_HCHAR 8
  81. #define HERC_VTIC 5
  82. #define HERC_HTIC 5
  83.  
  84.  
  85.  
  86. #define EGA_XMAX 640
  87. #define EGA_YMAX 350
  88.  
  89. #define EGA_XLAST (EGA_XMAX - 1)
  90. #define EGA_YLAST (EGA_YMAX - 1)
  91.  
  92. #define EGA_VCHAR 18
  93. #define EGA_HCHAR 8
  94. #define EGA_VTIC 5
  95. #define EGA_HTIC 5
  96.  
  97.  
  98. #define VGA_XMAX 640
  99. #define VGA_YMAX 480
  100.  
  101. #define VGA_XLAST (VGA_XMAX - 1)
  102. #define VGA_YLAST (VGA_YMAX - 1)
  103.  
  104. #define VGA_VCHAR 24
  105. #define VGA_HCHAR 8
  106. #define VGA_VTIC 5
  107. #define VGA_HTIC 5
  108.  
  109.  
  110. #define SVGA_XMAX 800
  111. #define SVGA_YMAX 600
  112.  
  113. #define SVGA_XLAST (SVGA_XMAX - 1)
  114. #define SVGA_YLAST (SVGA_YMAX - 1)
  115.  
  116. #define SVGA_VCHAR 24
  117. #define SVGA_HCHAR 8
  118. #define SVGA_VTIC 5
  119. #define SVGA_HTIC 5
  120.  
  121. #define SSVGA_XMAX 1024
  122. #define SSVGA_YMAX 768
  123.  
  124. #define SSVGA_XLAST (SSVGA_XMAX - 1)
  125. #define SSVGA_YLAST (SSVGA_YMAX - 1)
  126.  
  127. #define SSVGA_VCHAR 24
  128. #define SSVGA_HCHAR 8
  129. #define SSVGA_VTIC 5
  130. #define SSVGA_HTIC 5
  131.  
  132.  
  133. static int vga256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
  134. static int *vgacolor = vga256color;
  135. static fg_color_t vga_color;
  136. static int text_angle;
  137. static fg_line_t line_to_draw;
  138.  
  139. int VGA_text_angle(ang)
  140. int ang;
  141. {
  142.     text_angle = ang;
  143.     return TRUE;
  144. }
  145.  
  146. int VGA_justify_text(mode)
  147. enum JUSTIFY mode;
  148. {
  149.     return FALSE;
  150. }
  151.  
  152. int VGA_init()
  153. {
  154.        if (fg_init() == FG_NULL)  {
  155.            fprintf(stderr,"Graphics card not detected.\n");
  156.            exit(1);
  157.       }
  158. }
  159.  
  160. int HERC_graphics()
  161. {
  162.    fg_init_herc();
  163.    graphics_on = TRUE;
  164. }
  165.  
  166. int EGAMONO_graphics()
  167. {
  168.    fg_init_egamono();
  169.    graphics_on = TRUE;
  170. }
  171.  
  172. int EGA_graphics()
  173. {
  174.    fg_init_egaecd();
  175.    graphics_on = TRUE;
  176. }
  177.  
  178. int VGA_graphics()
  179. {
  180.    fg_init_vga12();
  181.    graphics_on = TRUE;
  182. }
  183.  
  184. int VGAMONO_graphics()
  185. {
  186.    fg_init_vga11();
  187.    graphics_on = TRUE;
  188. }
  189.  
  190. int SVGA_graphics()
  191. {
  192.    fg_init_vesa6a();
  193.    graphics_on = TRUE;
  194. }
  195.  
  196. int SSVGA_graphics()
  197. {
  198.    fg_init_vesa5();
  199.    graphics_on = TRUE;
  200. }
  201.  
  202. int VGA_linetype(linetype)
  203. {
  204.     if (linetype >= 15)
  205.         linetype %= 15;
  206.     vga_color = fg.color[vgacolor[linetype+2]];
  207. }
  208.  
  209. int VGA_put_text(x,y,str)
  210. unsigned int x, y;
  211. char *str;
  212. {
  213.    fg_puts(vga_color, FG_MODE_SET,    ~0,  text_angle, x, y, str, fg.displaybox);
  214. }
  215.  
  216. int VGA_move(x,y)
  217. {
  218.      line_to_draw[FG_X1] = x;
  219.      line_to_draw[FG_Y1] = y;
  220. }
  221.  
  222.  
  223. int VGA_vector(x,y)
  224. {
  225.      line_to_draw[FG_X2] = x;
  226.      line_to_draw[FG_Y2] = y;
  227.      fg_drawline(vga_color, FG_MODE_SET, ~0, FG_LINE_SOLID, line_to_draw);
  228.      line_to_draw[FG_X1] = x;
  229.      line_to_draw[FG_Y1] = y;
  230. }
  231.  
  232. int VGA_text()
  233. {
  234.     if (graphics_on) {
  235.         graphics_on = FALSE;
  236.         fg_flush();
  237.         pause();
  238.     }
  239.    fg_term();
  240. }
  241.  
  242. int VGA_reset()
  243. {
  244.    fg_term();
  245. }
  246.